//
//  ViewController.m
//  WPieChart
//
//  Created by winter on 16/1/5.
//  Copyright © 2016年 winter. All rights reserved.
//

#import "ViewController.h"
#import "WPieChartView.h"

#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor yellowColor];
    
    WPieChartView *pieChartView = [[WPieChartView alloc] initWithFrame:CGRectMake(70, 100, 160, 160)];
    [self.view addSubview:pieChartView];
    
    WPieChartDataItem *item1 = [WPieChartDataItem dataItemWithValue:100 color:[UIColor redColor]];
    WPieChartDataItem *item2 = [WPieChartDataItem dataItemWithValue:200 color:[UIColor blueColor]];
    WPieChartDataItem *item3 = [WPieChartDataItem dataItemWithValue:50 color:[UIColor orangeColor]];
    WPieChartDataItem *item4 = [WPieChartDataItem dataItemWithValue:80 color:[UIColor purpleColor]];

    
    pieChartView.items = @[item1, item2, item3, item4];
    
//    [pieChartView amplifyPieChartWithIndex:0 amplifyValue:10];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
    label.text = @"图表";
    label.textAlignment = NSTextAlignmentCenter;
    label.center = CGPointMake(80, 80);
    [pieChartView addSubview:label];
}



@end
